<% this_freshman=favorite_freshman.freshman %>
<li class="favorite_freshman <%= cycle("even", "odd") %>" id="favorite_<%= favorite_freshman.id %>"><%= this_freshman.first_name %> <%= this_freshman.last_name %>
<%= if @more_checks_allowed
      link_to_remote "run check", :update => 'freshman_history', :url => { :action => 'run_check', :freshman_id => this_freshman.id},  :confirm => "Are you sure?"
    end %>
<%= link_to_remote "show history", :update => 'freshman_history', :url => { :action => 'show_history', :freshman_id => this_freshman.id} %>
<%= link_to_remote "remove favorite", :update=> 'favorite_freshmen', :url => { :action => 'remove_favorite', :freshman_id =>this_freshman.id} %>
<%= if favorite_freshman.last_monitor_check.nil?
      if @more_monitors_allowed
        link_to_remote "set monitor", :update=> 'favorite_freshmen', :url => { :action => 'set_monitor', :favorite_freshman_id =>favorite_freshman.id}
      end
    else
      link_to_remote "remove monitor", :update=> 'favorite_freshmen', :url => { :action => 'remove_monitor', :favorite_freshman_id =>favorite_freshman.id}
    end %>
<div class="dateline">
<% last_check=@logged_in_user.house.checks.find(:first,
                                     :conditions => ["freshman_id = ?", this_freshman.id],
                                     :order => "checked_at DESC")
   if last_check.nil? %>
     Never checked
   <% else %>
     Last check: <%= last_check.checked_at %>
   <% end %>
</div>
<% unless favorite_freshman.last_monitor_check.nil?
     last_action=this_freshman.desk_actions.find(:first, :order => "recorded_at DESC")
     if (!last_action.nil? and (last_action.recorded_at > favorite_freshman.last_monitor_check)) %>
       <div class="dateline monitoralert">ZOMG MONITOR TRIPPED!!!
       <%= link_to_remote "reset without checking", :update=> 'favorite_freshmen', :url => { :action => 'set_monitor', :favorite_freshman_id =>favorite_freshman.id} %>
       </div>
<%   end
   end %>
</li>
